#include "stdafx.h"
#include "SceneManagerSvr.h"
#include "Scene/SceneDefinition.h"
#include "Scene/SceneInstance.h"
#include "Scene/SceneCity.h"
#include "Scene/SceneCombat.h"



SceneManagerSvr::SceneManagerSvr()
{

}

SceneManagerSvr::~SceneManagerSvr()
{

}

IScene*
SceneManagerSvr::addScene(int nStaticID, short type)
{
	int iInstanceID = 0;
	if (type==Scene::stCity)
	{
		iInstanceID = m_stoi[nStaticID];
	}

	IScene* pScene = NULL;
	if (iInstanceID==0)
	{
		pScene = __super::addScene(nStaticID, type);
	}
	else
	{
		pScene = getScene(iInstanceID);
	}
	return pScene;
}


bool
SceneManagerSvr::rmvScene(int nInstanceID)
{
	if (__super::rmvScene(nInstanceID))
	{
		m_stoi.erase(nInstanceID);
		return true;
	}
	else
	{
		return false;
	}
}

IScene*
SceneManagerSvr::createScene(int nStaticID, short type)
{
	IScene* pScene = NULL;
	switch(type)
	{
	case Scene::stHoldPoint:
	case Scene::stStage:
		{
			pScene = new SceneCombat;
			break;
		}
	case Scene::stInstance:
		{
			pScene = new SceneInstance;
			break;
		}
	case Scene::stCity:
		{
			pScene = new SceneCity;
			break;
		}
	default:;
	}

	

	return pScene;
}